<?php
namespace ctrl\demo;

use Sdk\Opene\callOpeneApiUtil;

class opene
{
    //获取仓库列表 http://ec.com/?c=demo_opene&a=warehouseList
    public static function warehouseList()
    {
        $action = '/api/accountwarehouse';
        $data = [];
        $result = callOpeneApiUtil::callOpeneApi($action, 'GET', $data);
        echo '<pre />';
        print_r($result);
    }

    //获取拉取谷仓库存列表 http://ec.com/?c=demo_opene&a=pull
    public static function pull()
    {
        \serv\task\warehouse\opene::pull();
    }

    //获取拉取谷仓库存列表 http://ec.com/?c=demo_opene&a=pullQueue
    public static function pullQueue()
    {
        $string = '{"warehouse_id":"168","warehouse_code":"POL3"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\opene::pull($data);
        var_dump($result);
    }

    //更新或锁 //http://ec.com/?c=demo_opene&a=stock
    public static function stock()
    {
        $string = '{"id":50229,"product":{"id":37049,"sku":"A0000209C-KDA","name":"chair","account_id":211,"weight":"23.0000","weight_unit":"POUND","dim_length":"27.0000","dim_width":"27.0000","dim_height":"9.0000","dim_unit":"INCH"},"warehouse_code":"POL3","warehouse_name":"萨瓦纳3仓","account_id":"211","account_name":"ECHAMP TRADING LIMITED","created":"2024-07-03T03:20:08Z","updated":"2024-07-22T22:14:43Z","inventory_qty":69,"hold_qty":0,"inbound_qty":174,"outbound_qty":105,"damaged_qty":0,"return_qty":0,"return_damage_qty":0,"destroyed_qty":0,"transfer_qty":0,"is_locked":false,"stock_type":"BIG","inventory_type":1,"frozen_qty":0,"account":211,"warehouse":26,"warehouse_id":"168"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\opene::check($data);
        var_dump($result);
    }

    //拉取入库单列表 //http://ec.com/?c=demo_opene&a=inboundList
    public static function inboundList()
    {
        $action = '/api/inboundnotice';
        $data = [];
        $result = callOpeneApiUtil::callOpeneApi($action, 'GET', $data);
        echo '<pre />';
        print_r($result);
    }

}